﻿using System;
using Csla;
using log4net;
using System.ComponentModel.DataAnnotations;
using Csla.Data;

namespace Sireass.Bl
{
    [Serializable]
    public class ResponsableInfo : ReadOnlyBase<ResponsableInfo>
    {
        // Create a logger for use in this class
        private static readonly ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        #region Propiedades

        public static readonly PropertyInfo<long> IdResponsableProperty = RegisterProperty<long>(c => c.IdResponsable);
        [Display(Name = "Id Responsable")]
        public long IdResponsable
        {
            get { return GetProperty(IdResponsableProperty); }
            private set { LoadProperty(IdResponsableProperty, value); }
        }

        public static readonly PropertyInfo<string> ResponsableProperty = RegisterProperty<string>(c => c.Responsable);
        [Display(Name = "Responsable")]
        public string Responsable
        {
            get { return GetProperty(ResponsableProperty); }
            private set { LoadProperty(ResponsableProperty, value); }
        }

        #endregion

        #region DataPortal

        private void Child_Fetch(System.Data.IDataReader data)
        {
            var safeData = new SafeDataReader(data);
            IdResponsable = safeData.GetInt64("nId_Persona_Administrativo");
            Responsable = safeData.GetString("cResponsable");
        }

        #endregion
    }
}
